<html>
<head><meta charset="utf-8"><title>Rustup Toolchains and Obscure Linux Platforms · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Rustup.20Toolchains.20and.20Obscure.20Linux.20Platforms.html">Rustup Toolchains and Obscure Linux Platforms</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="220918256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Rustup%20Toolchains%20and%20Obscure%20Linux%20Platforms/near/220918256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ella Stanforth <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Rustup.20Toolchains.20and.20Obscure.20Linux.20Platforms.html#220918256">(Dec 25 2020 at 11:43)</a>:</h4>
<p>A while back I attempted to port the rust compiler to a new platform (Linux with Musl libc and LLVM C++ libs). I thought this wouldn't be too difficult but unfortunately it was though eventually I was successful in creating a toolchain through hacking the musl docker scripts however my final result, although able to compile simple programs, was not able to recompile rust (probably my fault though I never got round to trying to fix that).</p>
<p>I had the thought that providing a totally statically linked toolchain for use as the stage 0 compiler when building rustc on new, more obscure Linux platforms would make bootstrapping on new Linux platforms much easier. Is this a feasible idea?</p>



<a name="220918336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Rustup%20Toolchains%20and%20Obscure%20Linux%20Platforms/near/220918336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Rustup.20Toolchains.20and.20Obscure.20Linux.20Platforms.html#220918336">(Dec 25 2020 at 11:45)</a>:</h4>
<p>It is not possible to bootstrap rustc using a statically compiled compiler. To load proc-macros, rustc needs to be dynamically linked.</p>



<a name="220918580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Rustup%20Toolchains%20and%20Obscure%20Linux%20Platforms/near/220918580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ella Stanforth <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Rustup.20Toolchains.20and.20Obscure.20Linux.20Platforms.html#220918580">(Dec 25 2020 at 11:53)</a>:</h4>
<p>Ah, that's a shame. Is it possible to compile rust with all libs statically liked except <code>ld.so</code>?</p>



<a name="220918638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Rustup%20Toolchains%20and%20Obscure%20Linux%20Platforms/near/220918638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Rustup.20Toolchains.20and.20Obscure.20Linux.20Platforms.html#220918638">(Dec 25 2020 at 11:55)</a>:</h4>
<p>You can remove the <code>crate-type = ["dylib"]</code> from <code>compiler/rustc_driver/Cargo.toml</code> to statically link everything except for certain system libraries like <code>ld.so</code> and <code>libc.so</code>.</p>



<a name="220918680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Rustup%20Toolchains%20and%20Obscure%20Linux%20Platforms/near/220918680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ella Stanforth <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Rustup.20Toolchains.20and.20Obscure.20Linux.20Platforms.html#220918680">(Dec 25 2020 at 11:56)</a>:</h4>
<p>Nice, I'll try that. Thank you so much for the help!</p>



<a name="220918681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Rustup%20Toolchains%20and%20Obscure%20Linux%20Platforms/near/220918681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Rustup.20Toolchains.20and.20Obscure.20Linux.20Platforms.html#220918681">(Dec 25 2020 at 11:56)</a>:</h4>
<p>It is not possible to dynamically link to <code>ld.so</code> and at the same time statically link to <code>libc.so</code>. <code>ld.so</code> depends on <code>libc.so</code>.</p>



<a name="220918743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Rustup%20Toolchains%20and%20Obscure%20Linux%20Platforms/near/220918743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ella Stanforth <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Rustup.20Toolchains.20and.20Obscure.20Linux.20Platforms.html#220918743">(Dec 25 2020 at 11:59)</a>:</h4>
<p>Okay that makes sense.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>